package edu.nctu.csie.jichang.database.model.cell;

import java.util.Arrays;

/**
 * 加上 reference 條件
 * @author Jichang
 */
public class ColumnFullInfo extends ColumnInfo{
	
	private Object[] allowValue = null; // TODO 目前沒有實作這個
	
	private boolean primaryKey   = false;
	private boolean unique       = false;
	private boolean index        = false;
	private boolean reference    = false;
	
	private String  nullableName = null;
	
	public ColumnFullInfo(String pContent) {
		super(pContent);
	}
	
	public ColumnFullInfo(ColumnInfo pColumnInfo) {
		super(pColumnInfo.getName());
		setColumnType(pColumnInfo.getColumnType());
		setNullable(pColumnInfo.isNullable());
		setRawType(pColumnInfo.getRawType());
		setRawTypeName(pColumnInfo.getRawTypeName());
		setSize(pColumnInfo.getSize());
		setRawDefault(pColumnInfo.getRawDefault());
	}

	public Object[] getAllowValue() {
		return allowValue;
	}
	public void setAllowValue(Object[] allowValue) {
		this.allowValue = allowValue;
	}
	public void setPrimaryKey(boolean primaryKey) {
		this.primaryKey = primaryKey;
	}
	public boolean isPrimaryKey() {
		return primaryKey;
	}
	public boolean isUnique() {
		return unique;
	}
	public void setUnique(boolean unique) {
		this.unique = unique;
	}
	public String getNullableName() {
		return nullableName;
	}
	public void setNullableName(String nullableName) {
		this.nullableName = nullableName;
	}
	public boolean isIndex() {
		return index;
	}
	public void setIndex(boolean index) {
		this.index = index;
	}
	public boolean isReference() {
		return reference;
	}
	public void setReference(boolean reference) {
		this.reference = reference;
	}

	@Override
	public String toString() {
		return "ColumnFullInfo [allowValue=" + Arrays.toString(allowValue)
				+ ", primaryKey=" + primaryKey + ", unique=" + unique
				+ ", index=" + index + ", reference=" + reference
				+ ", nullableName=" + nullableName + "]";
	}
	
}